package cn.com.surker.workcon.service.xugong;

import cn.com.surker.base.system.entity.SysLine;
import cn.com.surker.control.entity.ControlInvoice;
import cn.com.surker.production.dao.IndentDispatchDao;
import cn.com.surker.production.entity.ProductionIndentDispatch;
import cn.com.surker.workcon.common.GKJDBCService;
import cn.com.surker.workcon.service.ProductService;
import org.springframework.jdbc.core.JdbcTemplate;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 工控机的生产数据 Mapper 接口
 * </p>
 *
 * @author admin
 * @since 2024-09-26
 */
public class ProductServiceImpl extends GKJDBCService implements ProductService {

	@Resource
	private IndentDispatchDao indentDispatchDao;

	/**
	 * 根据erp的派单信息,查询派车数据
	 *
	 * @param dispatchId erp的派单id
	 * @return
	 */
	public ProductionIndentDispatch queryByDispatchId(Long lineId, Long dispatchId) {
		if (lineId == null || dispatchId == null) {
			return null;
		}
		SysLine line = getLine(lineId);
		JdbcTemplate lineJdbcTemp = getLineJdbcTemp(line);
		if (lineJdbcTemp == null) {
			return null;
		}
		ProductionIndentDispatch dispatch = indentDispatchDao.selectById(dispatchId);
		if (dispatch == null) {
			return null;
		}

		return null;
	}


	@Override
	public Boolean inProing(Long lineId, Long dispatchId) {
		if (lineId == null || dispatchId == null) {
			return null;
		}
		SysLine line = getLine(lineId);
		JdbcTemplate lineTemplate = getLineJdbcTemp(line);
		//	没有数据源
		if (lineTemplate == null) {
			return null;
		}
		return false;
	}

	@Override
	public List<ControlInvoice> findFullByMin(Long lineId, String lineName, Date minDate, Long minProdId) {
		if (lineId == null) {
			return null;
		}
		SysLine line = getLine(lineId);
		JdbcTemplate lineJdbcTemp = getLineJdbcTemp(line);
		if (lineJdbcTemp == null) {
			return null;
		}

		return null;
	}

	@Override
	public List<ControlInvoice> findByTime(Long lineId, String lineName, String startTime, String endTime) {
		if (lineId == null) {
			return null;
		}
		SysLine line = getLine(lineId);
		JdbcTemplate lineJdbcTemp = getLineJdbcTemp(line);
		if (lineJdbcTemp == null) {
			return null;
		}

		return null;
	}


}
